<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace app\admin\validate;

use think\Validate;

/**
 * 订单表验证器
 */
class OrderValidate extends Validate
{
    /**
     * 定义验证规则
     */
    protected $rule =   [
        'order_no' => 'require',
        'user_id' => 'require',
        'amount' => 'require',
        'total_quantity' => 'require',
        'create_time' => 'require',
        'update_time' => 'require',
        'status' => 'require',
    ];

    /**
     * 定义错误信息
     */
    protected $message  =   [
        'order_no' => '订单编号必须填写',
        'user_id' => '用户编号必须填写',
        'amount' => '订单金额必须填写',
        'total_quantity' => '商品总数必须填写',
        'create_time' => '创建时间必须填写',
        'update_time' => '更新时间必须填写',
        'status' => '订单状态必须填写',
    ];

    /**
     * 定义场景
     */
    protected $scene = [
        'save' => [
            'order_no',
            'user_id',
            'amount',
            'total_quantity',
            'create_time',
            'update_time',
            'status',
        ],
        'update' => [
            'order_no',
            'user_id',
            'amount',
            'total_quantity',
            'create_time',
            'update_time',
            'status',
        ],
    ];

}
